Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@tendermint/sig
Advanced tools
Sig is a signing library for Cosmos, supported in Node.js and browsers.
Sig provides JavaScript functions and TypeScript types for
Sig does not provide functions for
Sig is designed to work well with other libraries like
Sig is experimental and not recommended for use in production yet. Please help us test and improve it!
As always, please be careful to protect any mnemonic phrases, passwords, and private keys.
Please note that the NPM package name is @tendermint/sig
rather than @cosmos/sig
.
yarn add @tendermint/sig
npm install --save @tendermint/sig
import { createWalletFromMnemonic } from '@tendermint/sig';
const mnemonic = 'trouble salon husband push melody usage fine ensure blade deal miss twin';
const wallet = createWalletFromMnemonic(mnemonic); // BIP39 mnemonic string
/*
{
address: 'cosmos1asm039pzjkkg9ghlvj267p5g3whtxd2t4leg5c',
privateKey: Uint8Array [
202, 60, 140, 106, 178, 180, 60, 1,
186, 68, 206, 224, 207, 179, 79, 81,
119, 98, 98, 1, 207, 170, 209, 161,
1, 124, 151, 236, 205, 151, 3, 229
],
publicKey: Uint8Array [
3, 159, 35, 41, 130, 48, 3, 247,
139, 242, 113, 41, 200, 176, 73, 27,
102, 232, 113, 226, 80, 184, 107, 144,
217, 88, 151, 21, 22, 185, 68, 28,
211
]
}
*/
import { createAddress } from '@tendermint/sig';
const address = createAddress(publicKey); // Buffer or Uint8Array
// 'cosmos1asm039pzjkkg9ghlvj267p5g3whtxd2t4leg5c'
import { signTx } from '@tendermint/sig';
const tx = {
fee: {
amount: [{ amount: '0', denom: '' }],
gas: '10000'
},
memo: '',
msgs: [{
type: 'cosmos-sdk/Send',
value: {
inputs: [{
address: 'cosmos1qperwt9wrnkg5k9e5gzfgjppzpqhyav5j24d66',
coins: [{ amount: '1', denom: 'STAKE' }]
}],
outputs: [{
address: 'cosmos1yeckxz7tapz34kjwnjxvmxzurerquhtrmxmuxt',
coins: [{ amount: '1', denom: 'STAKE' }]
}]
}
}]
};
const signMeta = {
account_number: '1',
chain_id: 'cosmos',
sequence: '0'
};
const stdTx = signTx(tx, signMeta, wallet); // Wallet or privateKey / publicKey pair; see example above
/*
{
fee: { amount: [{ amount: '0', denom: '' }], gas: '10000' },
memo: '',
msgs: [{
type: 'cosmos-sdk/Send',
value: {
inputs: [{
'address': 'cosmos1qperwt9wrnkg5k9e5gzfgjppzpqhyav5j24d66',
'coins': [{ amount: '1', denom: 'STAKE' }]
}],
outputs: [{
address: 'cosmos1yeckxz7tapz34kjwnjxvmxzurerquhtrmxmuxt',
coins: [{ amount: '1', denom: 'STAKE' }]
}]
}
}],
signatures: [{
signature: 'uwQQzsubfzk/EwedKbZI/IDiXru5M6GuEBA2DZ+U7LVBwO80MFhU6ULA/5yjT8F0Bdx113VzS/GtbntazzNPwQ==',
pub_key: { type: 'tendermint/PubKeySecp256k1', value: 'A58jKYIwA/eL8nEpyLBJG2boceJQuGuQ2ViXFRa5RBzT' }
}]
}
*/
import { verifyTx } from '@tendermint/sig';
const valid = verifyTx(stdTx, signMeta); // signed transaction and metadata; see example above
// true
Please see the documentation for the full API.
git clone https://github.com/cosmos/sig.git
cd sig
yarn install
yarn setup
yarn test
Sig is very new! Questions, feedback, use cases, issues, and code are all very, very welcome.
Thank you for helping us help you help us all. 🎁
A number of other projects exist that help with signing for Cosmos.
Please check them out and see if they are right for you!
FAQs
A signing library for Cosmos
The npm package @tendermint/sig receives a total of 1,330 weekly downloads. As such, @tendermint/sig popularity was classified as popular.
We found that @tendermint/sig demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.